From: Aaron Schulz Date: Sun, 26 Jun 2011 23:32:46 +0000 (+0000) Subject: Restore new_name_timestamp index usage in UNION. Since r51907, there was no reason... X-Git-Tag: 1.31.0-rc.0~29253 X-Git-Url: http://git.cyclocoop.org/%22.%24info%5B?a=commitdiff_plain;h=4dc7c3188d11a5c2feffe46940e4f9ef955c627f;p=lhc%2Fweb%2Fwiklou.git Restore new_name_timestamp index usage in UNION. Since r51907, there was no reason for doing the UNION. Fixed "is_null( $namespace )" checks, broken probably since FormOptions was used here (NULL value not saved for 'namespace', left to default, which is ''). Added check for 'associated namespaces' option. --- diff --git a/includes/specials/SpecialRecentchanges.php b/includes/specials/SpecialRecentchanges.php index 4743d6eed8..da5d5f0072 100644 --- a/includes/specials/SpecialRecentchanges.php +++ b/includes/specials/SpecialRecentchanges.php @@ -365,6 +365,7 @@ class SpecialRecentChanges extends IncludableSpecialPage { $limit = $opts['limit']; $namespace = $opts['namespace']; $invert = $opts['invert']; + $associated = $opts['associated']; $fields = array( $dbr->tableName( 'recentchanges' ) . '.*' ); // all rc columns // JOIN on watchlist for users @@ -397,11 +398,11 @@ class SpecialRecentChanges extends IncludableSpecialPage { // Don't use the new_namespace_time timestamp index if: // (a) "All namespaces" selected - // (b) We want all pages NOT in a certain namespaces (inverted) + // (b) We want pages in more than one namespace (inverted/associated) // (c) There is a tag to filter on (use tag index instead) // (d) UNION + sort/limit is not an option for the DBMS - if( is_null( $namespace ) - || ( $invert && !is_null( $namespace ) ) + if( $namespace === '' + || ( $invert || $associated ) || $opts['tagfilter'] != '' || !$dbr->unionSupportsOrderAndLimit() ) { @@ -420,7 +421,7 @@ class SpecialRecentChanges extends IncludableSpecialPage { array( 'ORDER BY' => 'rc_timestamp DESC', 'LIMIT' => $limit, - 'USE INDEX' => array( 'recentchanges' => 'rc_timestamp' ) + 'USE INDEX' => array( 'recentchanges' => 'new_name_timestamp' ) ), $join_conds ); @@ -433,7 +434,7 @@ class SpecialRecentChanges extends IncludableSpecialPage { array( 'ORDER BY' => 'rc_timestamp DESC', 'LIMIT' => $limit, - 'USE INDEX' => array( 'recentchanges' => 'rc_timestamp' ) + 'USE INDEX' => array( 'recentchanges' => 'new_name_timestamp' ) ), $join_conds );